import { createRouter, createWebHashHistory } from 'vue-router'
import { constantRoute } from './routes'

/*let router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoute,
  // 滚动行为
  scrollBehavior() {
    return {
      left: 0,
      top: 0,
    }
  },
})*/
export function creRouter() {
  return createRouter({
    history: createWebHashHistory(),
    routes: constantRoute,
    // 滚动行为  ss
    scrollBehavior() {
      return {
        left: 0,
        top: 0,
      }
    },
  })
}
const router = creRouter()

export function resetRouter() {
  const newRouter = createRouter({
    history: createWebHashHistory(),
    routes: constantRoute,
    // 滚动行为
    scrollBehavior() {
      return {
        left: 0,
        top: 0,
      }
    },
  })
  // router.matcher = newRouter.matcher //路由重置
}
export default router
